import request from '@/config/axios'

// 模具仓库 API
export const StockIoApi = {
  // 查询模具仓库列表
  login: async (params: { cardNumber: string; tenant_id: string }) => {
    return await request.get({
      url: `/mold/workstation/stockio/login`,
      params
    })
  },
  // 分页查询模具出入库列表
  getPage: async (
    params: { pageNo: number; pageSize: number },
    headers: { 'Tenant-Id': string }
  ) => {
    console.log('headers', headers)
    return await request.get({
      url: '/mold/workstation/stockio/page',
      params,
      headers: headers
    })
  },

  modStatus: async (
    params: { user_id: number; account_id: number; status: string; data: string },
    headers: { 'Tenant-Id': string }
  ) => {
    return await request.put({
      url: `/mold/workstation/stockio/account-status`,
      params,
      headers: headers
    })
  },

  modMutiStatus: async (
    params: { userId: number; accountIds: number[]; status: number; data: string },
    headers: { 'Tenant-Id': string }
  ) => {
    return await request.put({
      url: `/mold/workstation/stockio/accounts-status`,
      data: params, // 使用 data 而不是 params
      headers: {
        'Content-Type': 'application/json',
        ...headers
      }
    })
  },

  getDrawingNos: async (headers: { 'Tenant-Id': string }) => {
    return await request.get({
      url: `/mold/workstation/stockio/drawingNos`,
      headers: headers
    })
  }
}
